package com.ruoyi.user.service.impl;

import com.ruoyi.user.domain.UserAnnouncement;
import com.ruoyi.user.mapper.UserAnnouncementMapper;
import com.ruoyi.user.service.IUserAnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 公告Service业务层处理
 */
@Service
public class UserAnnouncementServiceImpl implements IUserAnnouncementService {
    @Autowired
    private UserAnnouncementMapper userAnnouncementMapper;

    /**
     * 查询公告
     */
    @Override
    public UserAnnouncement selectUserAnnouncementById(Long announcementId) {
        return userAnnouncementMapper.selectUserAnnouncementById(announcementId);
    }

    /**
     * 查询公告列表
     */
    @Override
    public List<UserAnnouncement> selectUserAnnouncementList(UserAnnouncement userAnnouncement) {
        return userAnnouncementMapper.selectUserAnnouncementList(userAnnouncement);
    }

    /**
     * 查询用户可见的公告列表
     */
    @Override
    public List<UserAnnouncement> selectUserAnnouncements(Long customerId, Long regionId) {
        return userAnnouncementMapper.selectUserAnnouncements(customerId, regionId);
    }

    /**
     * 新增公告
     */
    @Override
    public int insertUserAnnouncement(UserAnnouncement userAnnouncement) {
        return userAnnouncementMapper.insertUserAnnouncement(userAnnouncement);
    }

    /**
     * 修改公告
     */
    @Override
    public int updateUserAnnouncement(UserAnnouncement userAnnouncement) {
        return userAnnouncementMapper.updateUserAnnouncement(userAnnouncement);
    }

    /**
     * 删除公告
     */
    @Override
    public int deleteUserAnnouncementById(Long announcementId) {
        return userAnnouncementMapper.deleteUserAnnouncementById(announcementId);
    }

    /**
     * 批量删除公告
     */
    @Override
    public int deleteUserAnnouncementByIds(Long[] announcementIds) {
        return userAnnouncementMapper.deleteUserAnnouncementByIds(announcementIds);
    }

    /**
     * 查询用户未读公告数量
     */
    @Override
    public int selectUnreadUserAnnouncementCount(Long customerId, Long regionId) {
        return userAnnouncementMapper.selectUnreadUserAnnouncementCount(customerId, regionId);
    }
}